(SST) ShlWAPI.pas Version 1.08

Developer Reference
(SST)ShlWAPI PathIsDirectory Function
Ascertains whether the specified path exists and is that of a file system folder/directory.
Scope
Global (i.e. this function can be called/accessed from code in any unit that includes/uses (SST)ShlWAPI.pas).
Syntax
function PathIsDirectory(pszPath : LPCSTR) : BOOL;
Parameters
pszPath [in] Depending on which version of the function is called, a pointer to the zero terminated ANSI or Unicode string that is the path to check. It should not exceed MAX_PATH (= 260 characters, including the terminating zero) in length.
Return Values
Returns TRUE if the specified path string adheres to a file sytem object naming convention, that is recognized by the operating system (e.g. DOS, UNC) and the folder/directory exists. It returns FALSE, if the string does not have the correct format for a file system path, references a file instead of a folder/directory, or doesn't exist.
Remarks
This function is similar but not identical in its functionality to the Delphi SDK function DirectoryExists..
Example
PROCEDURE TForm4.TestShlWAPIPathPathIsDirectory(Sender : TObject); VAR pathtotest : STRING; VAR apiretval : BOOL; VAR newinfoline : STRING; BEGIN pathtotest := ''; apiretval := FALSE; newinfoline := ''; pathtotest := 'C:\Windows\System32'; newinfoline := 'PathIsDirectory called with ' + pathtotest; Memo1.Lines.Add(newinfoline); apiretval := PathIsDirectory(PChar(pathtotest)); IF apiretval THEN newinfoline := 'TRUE' ELSE newinfoline := 'FALSE'; Memo1.Lines.Add(newinfoline); pathtotest := 'C:/Program Files/Internet Explorer/en-US'; newinfoline := 'PathIsDirectory called with ' + pathtotest; Memo1.Lines.Add(newinfoline); apiretval := PathIsDirectory(PChar(pathtotest)); IF apiretval THEN newinfoline := 'TRUE' ELSE newinfoline := 'FALSE'; Memo1.Lines.Add(newinfoline); pathtotest := 'C:\Windows\System32\Shell32.dll'; newinfoline := 'PathIsDirectory called with ' + pathtotest; Memo1.Lines.Add(newinfoline); apiretval := PathIsDirectory(PChar(pathtotest)); IF apiretval THEN newinfoline := 'TRUE' ELSE newinfoline := 'FALSE'; Memo1.Lines.Add(newinfoline); pathtotest := 'C:\Windows\System32\Hello\World'; newinfoline := 'PathIsDirectory called with ' + pathtotest; Memo1.Lines.Add(newinfoline); apiretval := PathIsDirectory(PChar(pathtotest)); IF apiretval THEN newinfoline := 'TRUE' ELSE newinfoline := 'FALSE'; Memo1.Lines.Add(newinfoline); Memo1.Lines.Add(''); END;
The above example will generally produce the following output:
PathIsDirectory called with C:\Windows\System32 TRUE PathIsDirectory called with C:/Program Files/Internet Explorer/en-US TRUE PathIsDirectory called with C:\Windows\System32\Shell32.dll FALSE PathIsDirectory called with C:\Windows\System32\Hello\World FALSE
Requirements
Unit: Declared and imported in (SST)ShlWAPI.pas
Library: (SST)ShlWAPI.dcu/(SST)ShlWAPI.obj
Unicode: Implemented as ANSI (PathIsDirectory and PathIsDirectoryA) and Unicode (PathIsDirectoryW) functions.
Min. ShlWAPI.dll version according to MS SDK doc.: 4.71
Min. ShlWAPI.dll version based on SST research: 4.71
Min. OS version(s) according to Microsoft SDK doc.: Windows 2000, Windows NT 4.0 with Internet Explorer 4.0, Windows 98, Windows 95 with Internet Explorer 4.0
Min. OS version(s) according to SST research.: Windows NT 4.0 with IE 4.0, Windows 95 with IE 4.0, Windows 98, Windows 2000 and later
See Also
PathIsRoot
 
Windows APIs: PathIsDirectory, PathIsDirectoryEmpty, PathIsFileSpec, PathIsNetworkPath, PathIsRelative, PathIsRoot, PathIsSystemFolder, PathIsUNCServer, PathIsUNCServerShare PathIsURL.


Document/Contents version 1.00
Page/URI last updated on 07.12.2023
 
Copyright © Stoelzel Software Technologie (SST) 2010 - 2017
Suggestions and comments mail to:
webmaster@stoelzelsoftwaretech.com